#include<iostream>
using namespace std;
long long T;
long long a,b,c;
long long Min()
{
    return min(min(a,b),c);
}
int main()
{
    cin>>T;
    while(T--)
    {
        cin>>a>>b>>c;
        if(a==b&&b==c){
            cout<<b*2<<endl;
        }
        else if(Min()==c&&b!=c) //不然b-c-1是负的
        {
            cout<<c*2+(b-c-1)<<endl;
        }
        else if(Min()==a&&b!=a)
        {
            //a最小
            cout<<a*2+(b-a-1)<<endl;
        }
        else if(Min()==b)
        {
             cout<<b*2<<endl;
        }
    }
    return 0;
}